
package com.funo.government.info;

import java.util.ArrayList;

import android.app.Activity;
import android.app.Application;

import com.funo.government.info.utils.CrashHandler;

public class MainApplication extends Application {

    ArrayList<Activity> mActivities;

    @Override
    public void onCreate() {
        super.onCreate();
        mActivities = new ArrayList<Activity>();
        CrashHandler crashHandler = CrashHandler.getInstance();
        crashHandler.init(getApplicationContext());
    }

    public void addActivity(Activity activity) {
        mActivities.add(activity);
    }

    public void removeActivity(Activity activity) {
        mActivities.remove(activity);
    }

    public void finishAll() {
        for (Activity activity : mActivities) {
            if (!activity.isFinishing()) {
                activity.finish();
            }

        }
        mActivities = null;
    }

}
